package com.example.fbi_text.views;

import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.fbi_text.R;

public class AccountGroupView extends LinearLayout {
    private ImageView maccount_avatar;
    private TextView musername;
    private TextView mpassword;

    public AccountGroupView(Context context) {
        super(context);
        initView();
    }

    public AccountGroupView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initView();
    }
    public void initView(){
        LayoutInflater.from(getContext()).inflate(R.layout.account_item,this,true);
        maccount_avatar=findViewById(R.id.account_avatar);
        musername=findViewById(R.id.username);
        mpassword=findViewById(R.id.password);
    }
    public void setMaccount_avatar(String account_avatar){
        if (maccount_avatar!=null&&!TextUtils.isEmpty(account_avatar)){
            maccount_avatar.setImageResource(Integer.parseInt(account_avatar));
        }
    }
    public void setMusername(String username){
        if (musername!=null&&!TextUtils.isEmpty(username)){
            musername.setText(username);
        }
    }
    public void setMpassword(String password){
        if (mpassword!=null&&!TextUtils.isEmpty(password)){
            mpassword.setText(password);
        }
    }
}
